package com.ss.android.article.base.feature.main;

import android.os.Handler;

import com.ss.android.article.base.feature.c.FeedAdapter;
import com.ss.android.messagebus.Subscriber;
import com.ss.android.messagebus.SubscriptionRouter;

public final class FeedShowDetector {
    public interface FeedShowDetector2 {
        void onFeedShow(boolean arg1);

        void onWaitFeedTimeout();
    }

    boolean a;
    boolean b;
    FeedShowDetector2 c;
    private Handler d;
    private boolean e;

    public FeedShowDetector(FeedShowDetector2 arg2) {

        this.d = new c(this);
        this.c = arg2;
    }

    public final void a() {
        this.d.sendEmptyMessageDelayed(0, 5000);
        SubscriptionRouter.addSubscriber(this);
    }

    public final void b() {
        this.d.removeMessages(0);
        SubscriptionRouter.removeSubscriber(this);
    }

    public final boolean c() {
        boolean v0 = (this.b) || (this.a) ? true : false;
        return v0;
    }

    @Subscriber public final void onFeedFirstShow(FeedAdapter.b$b arg3) {
        this.d.removeMessages(0);
        if(!this.e || !this.b) {
            this.b = true;
            this.e = arg3.a;
            this.c.onFeedShow(this.e);
        }
    }
}

